package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.BaseTrademark;
import com.atguigu.gmall.product.mapper.BaseTrademarkMapper;
import com.atguigu.gmall.product.service.BaseTrademarkService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author: 🐱🐱🐱
 * @Date: 2025/8/18 20:53
 * @Description:
 **/
@Service
public class BaseTrademarkServiceImpl implements BaseTrademarkService {

    @Resource
    private BaseTrademarkMapper baseTrademarkMapper;
    @Override
    public IPage<BaseTrademark> getPage(Page<BaseTrademark> trademarkPage) {
        QueryWrapper<BaseTrademark> wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("id");
        wrapper.eq("is_deleted",0);
        return baseTrademarkMapper.selectPage(trademarkPage,wrapper);
    }

    @Override
    public void save(BaseTrademark baseTrademark) {
        baseTrademarkMapper.insert(baseTrademark);
    }

    @Override
    public BaseTrademark get(String id) {
        return baseTrademarkMapper.selectById(id);
    }



    @Override
    public void removeById(Long id) {
        baseTrademarkMapper.deleteById(id);
    }

    @Override
    public void updateById(BaseTrademark baseTrademark) {
        baseTrademarkMapper.updateById(baseTrademark);
    }
}
